import Vue from "vue";
import VueRouter from "vue-router";
import Default from "../views/default/default.vue";
import Admin from '@/views/admin'
Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "default",
    component: Default,
    hidden: true,
  },
  {
    path: "/login",
    name: "login",
    hidden: true,
    component: () => import("@/views/login/login.vue"),
  },
  {
    path: "/admin",
    component: Admin,
    redirect: '/admin',
    name:'admin',
    meta:{title:'后台系统'},
    children: [
      {
        path: '/',
        name: 'Info',
        meta:{title:'系统详情'},
        component: () => import("@/views/admin/view/info/index.vue"),
      },
      {
        path: 'blog',
        name: 'Blog',
        meta:{title:'博客管理'},
        component: () => import("@/views/admin/view/blog/index.vue"),
      },
      {
        path: 'word',
        name: 'Word',
        meta:{title:'每日美句'},
        component: () => import("@/views/admin/view/word/word.vue"),
      },
      {
        path:'role',
        name:'role1',
        meta:{title:'角色管理'},
        children:[
          {
            path:'add',
            name:'add',
            meta:{title:'权限控制1'},
            component: () => import("@/views/admin/view/role/index.vue"),
          }
        ],
      }
    ],
  },
  {
    path: '*',
    name: '404',
    component: () => import("@/views/error/404.vue"),
  }
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes
});

export default router;
